#pragma once

#include "../Util/Singleton.h"
#include "Keyboard.h"
#include "InputEntry.h"
#include "InputAction.h"
#include <vector>

//Macro defined to have the code a little bit clean
#define IsPressed(ACTION) cInputManager::Get().GetAction(ACTION).GetIsPressed()

//Device enumerator
enum eDevices
{
  eKeyboard = 0
};

//Struct to hold the mapping of the actions
struct tActionMapping
{
  int miAction;
  int miDevice;
  int miChannel;
};

//Class Input Manager
class cInputManager : public cSingleton<cInputManager>
{
  protected:
    cInputManager(){;}
  private:
    std::vector<cGenericDevice *> mDevices; //Hold the devices associated to the manager
    std::vector<cInputAction> mActions; ///Hold the actions
    std::vector< std::vector <cInputEntry> > mMapped; //Hold the map between actions and devices
    float Check(int liDevice, int liChannel);
  public:
    friend class cSingleton<cInputManager>;
    void Init(const tActionMapping laActionMapping[], unsigned luiActionCount);
    void Update(const float &lfTimeStep);
    inline cInputAction &GetAction(const int &lActionId) { return mActions[lActionId]; }
    void Deinit(void);
};
